/*
 * jpnTeamRosters.java
 *
 * Created on 3 août 2008, 10:04
 */
package bbos.General.Views.Rosters;

import bbos.*;
import bbos.General.Model.*;
import java.util.Vector;
import javax.swing.ImageIcon;
import bbos.Tools.sdLang;
import java.awt.Image;
/**
 *
 * @author  frederic
 */
import java.awt.Image;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

public class jpnTeamRosters extends javax.swing.JPanel {

    /** Creates new form jpnTeamRosters */
    public jpnTeamRosters() {
        initComponents();

        Vector teams_types = mBBoS.getSingleton().getTeamTypes();
        for (int i = 0; i < teams_types.size(); i++) {
            mTeamRoster team = (mTeamRoster) teams_types.get(i);
            
            //jtpTeamRosters.add(sdLang.getSingleton().getResource(team.getName()),new jpnTeamRoster(team));

            try {
                URL url = new URL(team.getLogoURL());
                java.awt.Image image = java.awt.Toolkit.getDefaultToolkit().getDefaultToolkit().createImage(url);
                ImageIcon icon = new ImageIcon(image.getScaledInstance(16, 16, Image.SCALE_SMOOTH));
                jtpTeamRosters.addTab(sdLang.getSingleton().getResource(team.getName()), icon, new jpnTeamRoster(team), sdLang.getSingleton().getResource(team.getName()));
            } catch (MalformedURLException e) {
            } catch (IOException e) {
            }
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents()
    {

        jScrollPane1 = new javax.swing.JScrollPane();
        jtxDescription = new javax.swing.JTextPane();
        jtpTeamRosters = new javax.swing.JTabbedPane();

        setLayout(new java.awt.BorderLayout());

        jtxDescription.setEditable(false);
        jtxDescription.setText("The following rosters are the ones allowed in the leagues.");
        jScrollPane1.setViewportView(jtxDescription);

        add(jScrollPane1, java.awt.BorderLayout.NORTH);
        add(jtpTeamRosters, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTabbedPane jtpTeamRosters;
    private javax.swing.JTextPane jtxDescription;
    // End of variables declaration//GEN-END:variables
}
